// 创建用户集合独立文件

const mongoose = require('mongoose');

// 创建User集合规则
const UserSchema = new mongoose.Schema({
    name: {
        type: String,
        required: true,
        minlength: 2,
        maxlength: 8,
        trim: true
    },
    age: Number,
    hobbies: [String],
    email: {
        type: String,
        required: true
    },
    password: {
        type: String,
        required: true,
        minlength: 6,
        maxlength: 16
    }
});
// 创建集合
const User = mongoose.model('User', UserSchema);

// 导出功能
module.exports = User;